package com.xuecheng.learning.feignclient;

import com.xuecheng.content.model.po.Teachplan;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TeachplanServiceClientFallbackFactory implements FallbackFactory<TeachplanServiceClient> {
    @Override
    public TeachplanServiceClient create(Throwable throwable) {
        return new TeachplanServiceClient(){
            @Override
            public Teachplan getTeachplanisFree(Long teachplanId) {
                log.error("获取课程计划信息服务发生熔断:{}", throwable.toString(),throwable);
                return null;
            }
        };
    }
}
